.text
.global _start, _undef, _swi, _pabort, _dabort, _irq, _fiq

// 2nboot程序设置了栈底，初始值0xFFFF8000

_start:                     // 地址 0x42C00000
    bl init_all             // 初始化
    // .word 0xFFFF0000
    // swi 0x123
    b main


_undef:
    stmdb sp!, {r0-r12, lr}             // 保存现场，lr存的是产生undef异常的指令的下一条指令地址；
    sub r0, lr, #4
    bl except_und
    ldmia sp!, {r0-r12, pc}^            // 恢复现场，'^'表示恢复CPSR；

_swi:
    stmdb sp!, {r0-r12, lr}
    sub r0, lr, #4
    bl except_swi
    ldmia sp!, {r0-r12, pc}^

_pabort:
    sub	lr, lr, #4
    stmdb sp!, {r0-r12, lr}
    mov r0, lr
    bl except_pabort
    ldmia sp!, {r0-r12, pc}^

_dabort:
    sub	lr, lr, #8
    stmdb sp!, {r0-r12, lr}
    mov r0, lr
    bl except_dabort
    ldmia sp!, {r0-r12, pc}^
    b .

_irq:
    sub	lr, lr, #4
    stmdb sp!, {r0-r12, lr}
    sub r0, lr, #4
    bl except_irq
    ldmia sp!, {r0-r12, pc}^

_fiq:
    b .
